package config

type ApiConf struct {
	ServiceName string `mapstructure:"serverName"`
	Port        int    `json:"port" yaml:"port"`

	Nacos         NacosConfig   `mapstructure:"nacosConfig"`
	Jwt           JWTConf       `yaml:"jwt"`
	Consul        ConsulConf    `yaml:"consul"`
	Redis         RedisConf     `yaml:"redis"`
	Crypto        CryptoConf    `yaml:"crypto"`
	AlipaySandbox AlipaySandbox `yaml:"alipaySandbox"`
	Mqtt          MqttConf      `yaml:"mqtt"`
	Chatgpt       ChatgptConf   `yaml:"chatgpt"`
}

type RpcConf struct {
	ServiceName string `mapstructure:"serverName"`
	Port        int    `json:"port" yaml:"port"`

	Nacos   NacosConfig `mapstructure:"nacosConfig"`
	Consul  ConsulConf  `yaml:"consul"`
	Redis   RedisConf   `yaml:"redis"`
	Crypto  CryptoConf  `yaml:"crypto"`
	Mongodb MongodbConf `yaml:"mongodb"`
	Mysql   MysqlConf   `yaml:"mysql"`
	Chatgpt ChatgptConf `yaml:"chatgpt"`
	Mqtt    MqttConf    `yaml:"mqtt"`
	Elastic ElasticConf `yaml:"elastic"`
}

type NacosConfig struct {
	ServerConfig struct {
		IpAddr string `mapstructure:"IpAddr"`
		Port   uint64 `mapstructure:"Port"`
	}
	ClientConfig struct {
		NamespaceId string `mapstructure:"NamespaceId"`
	}
	ConfigParam struct {
		DataId string `mapstructure:"DataId"`
		Group  string `mapstructure:"Group"`
	}
}
type CryptoConf struct {
	Key string `yaml:"key"` //需要32位
}
type JWTConf struct {
	SigningKey string `yaml:"signingKey"`
}
type ConsulConf struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type MysqlConf struct {
	Root     string `yaml:"root"`
	Password string `yaml:"password"`
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Database string `yaml:"database"`
}
type RedisConf struct {
	Addr     string `yaml:"addr"`
	DB       int    `yaml:"DB"`
	Password string `yaml:"password"`
}
type MongodbConf struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}
type ElasticConf struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type ChatgptConf struct {
	HostUrl   string `yaml:"hostUrl"`
	Appid     string `yaml:"appid"`
	ApiSecret string `yaml:"apiSecret"`
	ApiKey    string `yaml:"apiKey"`
}
type MqttConf struct {
	Broker   string `yaml:"Broker"`
	Port     string `yaml:"Port"`
	ClientID string `yaml:"ClientID"`
	Username string `yaml:"Username"`
	Password string `yaml:"Password"`
}
type AlipaySandbox struct {
	APPID      string `yaml:"APPID"`
	PUBLICKEY  string `yaml:"PUBLIC_KEY"`
	PRIVATEKEY string `yaml:"PRIVATE_KEY"`
	NotifyURL  string `yaml:"NotifyURL"`
	ReturnURL  string `yaml:"ReturnURL"`
}

var (
	ApiC ApiConf
	RpcC RpcConf
)
